Last Update: Thu Dec 18 10:22:15 EST 1997
Please download these 3 files to a local directory before proceeding.
gradson the command line. If grads is not in your current directory, or if it is not in your PATH somewhere, you may need to enter the full pathname, ie:
/usr/homes/smith/grads/grads
Win32 Hint: You can also start GrADS from the Win32 GrADS program group.
GrADS will prompt you with a landscape vs. portrait question; just press enter. At this point a graphics output window should open on your console. You may wish to move or resize this window. Keep in mind that you will be entering GrADS commands from the window where you first started GrADS -- this window will need to be made the 'active' window and you will not want to entirely cover that window with the grahpics output window.
In the text window (where you started grads from), you should now see a prompt: ga-> You will enter GrADS commands at this prompt and see the results displayed in the graphics output window.
The first command you will enter is:
open model.ctlYou may want to see what is in this file, so enter:
query file
d psd is short for display. You will note that by default, GrADS will display an X, Y contour plot at the first time and at the lowest level in the data set.
Now you will enter commands to alter the 'dimension environment'. The display command (and implicitly, the access, operation, and output of the data) will do things with respect to the current dimension environment. You control the dimension environment by entering set commands:
In the above sequence of commands, we have set all four GrADS dimensions to a single value. When we set a dimension to a single value, we say that dimension is fixed. Since all the dimensions are fixed, when we display a variable we get a single value, in this case the value at the location 90W, 40N, 500hPa, and the 1st time in the data set.
clear clear the display set lon -90 set longitude fixed set lat 40 set latitude fixed set lev 500 set level fixed set t 1 set time fixed d z display a variable
If we now enter:
set lon -180 0 X is now a varying dimension d z
Now enter:
clearWe now have two varying dimensions, so by default we get a contour plot. If we have 3 varying dimensions:
set lat 0 90
d z
cwe get an animation sequence, in this case through time.
set t 1 5
d z
Now enter:
clearIn this case we have set the Y (latitude) and Z (level) dimensions to vary, so we get a vertical cross section. We have also displayed two variables, which simply overlay each other. You may display as many items as you desire overlaid before you enter the clear command.
set lon -90
set lat -90 90
set lev 1000 100
set t 1
d t
d u
Another example, in this case with X and T varying (Hovmoller plot):
cNow that you know how to select the portion of the data set to view, we will move on to the topic of operations on the data. First, set the dimension environment to an Z, Y varying one:
set lon -180 0
set lat 40
set lev 500
set t 1 5
d z
clearNow lets say that we want to see the temperature in Farenheit instead of Kelvin. We can do the conversion by entering:
set lon -180 0
set lat 0 90
set lev 500
set t 1
display (t-273.16)*9/5+32
clearto calculate the magnitude of the wind. A function is provided to do this calculation directly:
d sqrt(u*u+v*v)
d mag(u,v)Another built in function is the averaging function:
clearIn this case we calculate the 5 day mean. We can also remove the mean from the current field:
d ave(z,t=1,t=5)
d z - ave(z,t=1,t=5)We can also take means over longitude to remove the zonal mean:
clearWe can also perform time differencing:
d z-ave(z,x=1,x=72)
d z
clearThis computes the change between the two fields over 1 day. We could have also done this calculation using an offset from the current time:
d z(t=2)-z(t=1)
d z(t+1) - zThe complete specification of a variable name is:
name.file(dim +|-|= value, ...)If we had two files open, perhaps one with model output, the other with analyses, we could take the difference between the two fields by entering: display z.2 - z.1
Another built in function calculates horizontal relative vorticity via finite differencing:
clearYet another function takes a mass weighted vertical integral:
d hcurl(u,v)
clearHere we have calculated precipitable water in mm.
d vint(ps,q,275)
Now we will move on to the topic of controlling the grahpics output. So far, we have allowed GrADS to chose a default contour interval. We can override this by:
clearWe can also control the contour color by:
set cint 30
d z
clear
set ccolor 3
d z
clearThis is not very smooth; we can apply a cubic smoother by entering:
set gxout shaded
d hcurl(u,v)
clearWe can overlay different graphics types:
set csmooth on
d hcurl(u,v)
set gxout contourand we can annotate:
set ccolor 0
set cint 30
d z
draw title 500hPa Heights and VorticityWe can view wind vectors:
clear
set gxout vector
d u;v
d u;v;qor maybe:
d u;v;hcurl(u,v)You may display psuedo vectors by displaying any field you want:
clearHere the U component is the wind speed; the V component is moisture.
d mag(u,v) ; q*10000
We can also view streamlines (and colorize them):
clear
set gxout stream
d u;v;hcurl(u,v)
clearWe may wish to alter the map background:
set gxout grid
d u
To alter the projection:
clear set lon -110 -70 set lat 30 45 set mpdset hires set digsiz 0.2 Digit size set dignum 2 # of digits after decimal place d u
clear set lon -140 -40 set lat 15 80 set mpvals -120 -75 25 65 Map projection constants set mproj nps North Polar Stereographic set gxout contour set cint 30 d z
This concludes the sample session. At this point, you may wish to examine the data set further, or you may want to go through the GrADS documentation and try out the other options described there.
This server is used for the exchange of information on GrADS, announcements of upgrades, scripts, user defined functions, problem solving, etc. To join, send email to:
To subscribe, send mail to Sanzio Bassini (bassini@cineca.it) requesting inclusion in the GrADS User Group mailing list. Make sure to include your full name, affiliation and e-mail address.
An online archive for the listserver
is maintained at:
Office Head: Ricky Rood
Page Author: Arlindo da Silva